home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TSPA3340.ZIP / TSUNTE.INT < prev    next >
Text File  |  1992-10-05  |  7KB  |  190 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT E
  5. All rights reserved 19-Aug-89,
  6. Updated 25-Sep-89, 8-Oct-89, 4-Nov-89, 6-Dec-89, 24-Feb-90, 22-Jul-90,
  7.         1-Aug-90, 26-Aug-92, 5-Oct-92
  8.  
  9. Cursor routines, keyboard status, configuration information, file information,
  10. disk information, calendar routines.
  11. TSUNTE first appeared in release TSPAS13 of my Turbo Pascal units package.
  12.  
  13. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  14. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  15. ANY other usage, such as use in a business enterprise or a university,
  16. contact the author for the terms of registration.
  17.  
  18. The units are under development. Comments and contacts are solicited. If
  19. you have any questions, please do not hesitate to use electronic mail for
  20. communication.
  21. InterNet address: ts@uwasa.fi         (preferred)
  22. Bitnet address:   SALMI@FINFUN
  23.  
  24. The author shall not be liable to the user for any direct, indirect or
  25. consequential loss arising from the use of, or inability to use, any unit,
  26. program or file howsoever caused. No warranty is given that the units and
  27. programs will work under all circumstances.
  28.  
  29. Timo Salmi
  30. Professor of Accounting and Business Finance
  31. Faculty of Accounting & Industrial Management; University of Vaasa
  32. P.O. BOX 297, SF-65101 Vaasa, Finland
  33. *)
  34.  
  35. unit TSUNTE;
  36.  
  37. (* ======================================================================= *)
  38.                           interface
  39. (* ======================================================================= *)
  40.  
  41. uses Dos
  42.      {$IFDEF VER40}
  43.      ,TSUNT45
  44.      {$ENDIF}
  45.      ;
  46.  
  47. (* =======================================================================
  48.                          Screen related
  49.    ======================================================================= *)
  50.  
  51. (* Turns cursor off, and (since the update tspas13) retains the original
  52.    cursor size behind the scenes *)
  53. procedure CURSOFF;
  54.  
  55. (* Restores the cursor as it was before cursoff (unless, of course, you
  56.    have manipulated cursor size yourself in between) *)
  57. procedure CURSON;
  58.  
  59. (* Turns cursor on using user defined cursor size, the ordinary
  60.    color monitor CGA and EGA values are 6 and 7; VGA: 13,14 *)
  61. procedure CURSOR (LowerScanLine, UpperScanLine : byte);
  62.  
  63. (* Turns on a colored border, CGA and VGA, not EGA *)
  64. procedure BORDER (color : byte);
  65.  
  66. (* Is the monitor a monochrome monitor, if false, then color monitor *)
  67. function MONOFN : boolean;
  68.  
  69. (* =======================================================================
  70.                       Keyboard related
  71.    ======================================================================= *)
  72.  
  73. (* Clear the keyboard typeahead buffer *)
  74. procedure CLB;
  75.  
  76. (* Is CapsLock on *)
  77. function CAPSONFN : boolean;
  78.  
  79. (* Is NumLock on *)
  80. function NUMLONFN : boolean;
  81.  
  82. (* Is ScrollLock on *)
  83. function SCRLONFN : boolean;
  84.  
  85. (* Set CapsLock. Use true to turn on, false to turn off *)
  86. procedure CAPS (TurnOn : boolean);
  87.  
  88. (* Set NumLock. Use true to turn on, false to turn off *)
  89. procedure NUMLOCK (TurnOn : boolean);
  90.  
  91. (* Set ScrollLock. Use true to turn on, false to turn off *)
  92. procedure SCRLOCK (TurnOn : boolean);
  93.  
  94. (* =======================================================================
  95.                       File related
  96.    ======================================================================= *)
  97.  
  98. (* Does a file exist. Detects also read-only and/or hidden files.
  99.    If the name is a directory, false is returned, since directory
  100.    is not considered a file.
  101.    IMPORTANT: Never apply on an open file! *)
  102. function FEXISTFN (fnimi : string) : boolean;
  103.  
  104. (* The size of any file in bytes. In case of an error, returns -1
  105.    IMPORTANT: Never apply on an open file! *)
  106. function FSIZEFN (filename : string) : longint;
  107.  
  108. (* An alternative method for finding the file size. Can handle also
  109.    hidden files. Returns -1 if the file is not found or if FileName
  110.    is a directory or the volumeID *)
  111. function FSIZE2FN (FileName : string) : longint;
  112.  
  113. (* Space to files is allocated in whole clusters rather than by byte.
  114.    This function gives the cluster size of a device.
  115.    In case of an error, the function returns -1. *)
  116. function CLUSIZFN (device : char) : longint;
  117.  
  118. {$IFNDEF VER40}  (* Not Turbo Pascal 4.0 *)
  119. (* The size of a file in total allocated bytes.
  120.    In case of an error, returns -1
  121.    IMPORTANT: Never apply on an open file! *)
  122. function ALLSIZFN (filename : string) : longint;
  123. {$ENDIF}
  124.  
  125. (* Is a file's archive bit set or not. First test for the exisistence
  126.    of the file with FEXISTFN *)
  127. function ARCFILFN (name : string) : boolean;
  128.  
  129. (* Is a file a hidden file or not. First test for the exisistence
  130.    of the file with FEXISTFN *)
  131. function HIDFILFN (name : string) : boolean;
  132.  
  133. (* Is a file a read-only file or not. First test for the exisistence
  134.    of the file with FEXISTFN *)
  135. function RDOFILFN (name : string) : boolean;
  136.  
  137. (* Is a file a system file or not. First test for the exisistence
  138.    of the file with FEXISTFN *)
  139. function SYSFILFN (name : string) : boolean;
  140.  
  141. (* =======================================================================
  142.                       Disk related
  143.    ======================================================================= *)
  144.  
  145. {$IFNDEF VER40}  (* Not Turbo Pascal 4.0 *)
  146. (* Get a disk's volume label, returns an empty string on error or if
  147.    there is no label *)
  148. function LABELFN (device : char) : string;
  149. {$ENDIF}
  150.  
  151. (* Get the default drive *)
  152. function DEFDRVFN : char;
  153.  
  154. (* =======================================================================
  155.                        Date related
  156.    ======================================================================= *)
  157.  
  158. (* Modern weekday based on Zeller's congruence, valid after 14-Sep-1752,
  159.    Sun = 0, Mon = 1 ,..., Sat = 6 *)
  160. function WKDAYFN (day, month, year : word) : byte;
  161.  
  162. (* The number of days in a given month and year, that is the last day
  163.    of a month. Based on Zeller's congruence, valid after 14-Sep-1752 *)
  164. function LASTDMFN (month, year : word) : integer;
  165.  
  166. (* Is a given date a valid date.
  167.    Based on Zeller's congruence, valid from 1-Jan-1753 *)
  168. function DATEOKFN (day, month, year : word) : boolean;
  169.  
  170. (* This function returns the weeknumber of a given date.
  171.    If you consider that it starts on Sunday, set sunday_is_first true.
  172.    If you consider that the week starts on Monday, set sunday_is_first false.
  173.    Valid after 14-Sep-1752.
  174.    This function was programmed by Seppo Pynnönen, Ph.D.,
  175.    University of Vaasa, Finland, sjp@chyde.uwasa.fi *)
  176. function WEEKNRFN (day, month, year : word;
  177.                    sunday_is_first : boolean) : integer;
  178.  
  179. (* Zeller function, valid after 14-Sep-1752 *)
  180. function ZELLERFN (day, month, year : word) : real;
  181.  
  182. (* =======================================================================
  183.                        Miscellaneous
  184.    ======================================================================= *)
  185.  
  186. (* Returns the entire command line, first appearance in tspas14.arc
  187.    IMPORTANT: Must be applied before any file access *)
  188. function CMDLNFN : string;
  189.  
  190.